package cn.yl.caner.dao;

import java.sql.Connection;
import java.sql.SQLException;

import javax.sql.DataSource;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import cn.yl.caner.domain.AccountData;
import cn.yl.caner.domain.FindData;
import cn.yl.caner.utils.DataSourceUtils;
import cn.yl.caner.utils.MyDataSourceUtils;

public class FindDao {
	
	public AccountData findAccound(FindData finddata) throws SQLException  {
		//这个是查询账号信息的DAO层；
		Connection con = MyDataSourceUtils.getCurrentConnection();
		DataSource source = DataSourceUtils.getDataSource();
		QueryRunner q = new QueryRunner(source);
		String sql = "select * from account where username =?";
		String name = finddata.getFind_username();
		System.out.println("获取参数"+name);
		AccountData findaccount = q.query(con,sql,new BeanHandler<AccountData>(AccountData.class),name);
//		System.out.println(findaccount.toString());
		return  findaccount;
	}
}
